﻿using System;
using System.Web.UI.WebControls;

namespace MyWeb.Controls
{
    public partial class admLeft : System.Web.UI.UserControl
    {
        string admin = "0";
        private const string default_path_file = "/Admins/Default.aspx";
        public string LastLoadedPage
        {
            get { return ViewState["LastLoaded"] as string; }
            set { ViewState["LastLoaded"] = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LastLoadedPage = default_path_file;
            }
            if (Request.Cookies["Admin"] != null)
            {
                admin = Request.Cookies["Admin"].Value;
            }
            //if (admin == "1")
            //{
            //    pnQuantri.Visible = true;
            //    pnTintuc.Visible = true;
            //    pnhinhanh.Visible = true;
            //}
            //else if (admin == "2")
            //{
            //    pnQuantri.Visible = false;
            //    pnTintuc.Visible = true;
            //    pnhinhanh.Visible = false;
            //}
            //else
            //{
            //    pnQuantri.Visible = false;
            //    pnTintuc.Visible = false;
            //    pnhinhanh.Visible = true;
            //}
        }

        protected void LinkButton_Click(object sender, EventArgs e)
        {
            LinkButton lbt = (LinkButton)sender;
            LastLoadedPage = lbt.ID.Replace("lbt", "/Admins/") + ".aspx";
            Panel currentPanel = (Panel)lbt.Parent;
            Session["currentPanel"] = currentPanel.ID;
            Response.Redirect(LastLoadedPage);
        }
    }
}